package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.ScenicSpotOrders;
import com.ruoyi.system.service.IScenicSpotOrdersService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 景区订单模块Controller
 * 
 * @author lsj
 * @date 2024-12-21
 */
@RestController
@RequestMapping("/system/scenicSpotOrders")
public class ScenicSpotOrdersController extends BaseController
{
    @Autowired
    private IScenicSpotOrdersService scenicSpotOrdersService;

    /**
     * 查询景区订单模块列表
     */
    @PreAuthorize("@ss.hasPermi('system:scenicSpotOrders:list')")
    @GetMapping("/list")
    public TableDataInfo list(ScenicSpotOrders scenicSpotOrders)
    {
        startPage();
        List<ScenicSpotOrders> list = scenicSpotOrdersService.selectScenicSpotOrdersList(scenicSpotOrders);
        return getDataTable(list);
    }

    /**
     * 导出景区订单模块列表
     */
    @PreAuthorize("@ss.hasPermi('system:scenicSpotOrders:export')")
    @Log(title = "景区订单模块", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ScenicSpotOrders scenicSpotOrders)
    {
        List<ScenicSpotOrders> list = scenicSpotOrdersService.selectScenicSpotOrdersList(scenicSpotOrders);
        ExcelUtil<ScenicSpotOrders> util = new ExcelUtil<ScenicSpotOrders>(ScenicSpotOrders.class);
        util.exportExcel(response, list, "景区订单模块数据");
    }

    /**
     * 获取景区订单模块详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:scenicSpotOrders:query')")
    @GetMapping(value = "/{scenicSpotOrderid}")
    public AjaxResult getInfo(@PathVariable("scenicSpotOrderid") Long scenicSpotOrderid)
    {
        return success(scenicSpotOrdersService.selectScenicSpotOrdersByScenicSpotOrderid(scenicSpotOrderid));
    }

    /**
     * 新增景区订单模块
     */
    @PreAuthorize("@ss.hasPermi('system:scenicSpotOrders:add')")
    @Log(title = "景区订单模块", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ScenicSpotOrders scenicSpotOrders)
    {
        return toAjax(scenicSpotOrdersService.insertScenicSpotOrders(scenicSpotOrders));
    }

    /**
     * 修改景区订单模块
     */
    @PreAuthorize("@ss.hasPermi('system:scenicSpotOrders:edit')")
    @Log(title = "景区订单模块", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ScenicSpotOrders scenicSpotOrders)
    {
        return toAjax(scenicSpotOrdersService.updateScenicSpotOrders(scenicSpotOrders));
    }

    /**
     * 删除景区订单模块
     */
    @PreAuthorize("@ss.hasPermi('system:scenicSpotOrders:remove')")
    @Log(title = "景区订单模块", businessType = BusinessType.DELETE)
	@DeleteMapping("/{scenicSpotOrderids}")
    public AjaxResult remove(@PathVariable Long[] scenicSpotOrderids)
    {
        return toAjax(scenicSpotOrdersService.deleteScenicSpotOrdersByScenicSpotOrderids(scenicSpotOrderids));
    }
}
